import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:riverpod_annotation/riverpod_annotation.dart';

part 'time_provider.g.dart';
@riverpod
String time(Ref ref) {
  // 获取当前时间
  DateTime now = DateTime.now();
  // 提取当前小时数
  int hour = now.hour;

  if (hour >= 6 && hour < 12) {
    return '早上好';
  } else if (hour >= 12 && hour < 18) {
    return '中午好';
  } else if (hour >= 18 && hour < 24) {
    return '晚上好';
  } else {
    return '凌晨好';
  }
}
